import QuestionData as Q

identity = 0
QD = Q.QuestionData()

while 1:
    to_do = int (input ("Please choose what you want to do:1. create a new question 2. answer a question 3. change identity: "))

    if to_do == 1:
        question = str (input ("Please input the question: "))
        answer1 = str (input ("Please input the right answer: "))
        answer2 = str (input ("Please input the wrong answer1: "))
        answer3 = str (input ("Please input the wrong answer2: "))
        choice = [answer1,answer2,answer3]

        QD.AddQuestion (identity,question,choice)
    
    elif to_do == 2:
        qid = QD.RandomExtract (identity)
        if qid < 0:
            print ("No question exsists!")
        else:
            qlist = QD.ShowQuestion (identity,qid)
            question = qlist[0]
            choice = qlist[1]
            answer = int (input ("question:" + question + "    choice:" + str (choice) + "    your answer is: "))
            result = QD.Judger (answer)

            if result == 1:
                print ("Your answer is right!")
            else:
                print ("Your answer is wrong!")
    
    elif to_do == 3:
        identity = 1- identity

